﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    
    xmlns:localns="clr-namespace:MRULib.Views"
    >

    <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        Checkbox style for pin visual
      -->
    <Style TargetType="{x:Type localns:CheckPin}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type localns:CheckPin}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <BulletDecorator Background="Transparent"
                                         VerticalAlignment="Stretch"
                                         HorizontalAlignment="Stretch">
                            <BulletDecorator.Bullet>
                                <Viewbox Stretch="Fill">
                                    <Grid>
                                        <Canvas Width="100" Height="100" x:Name="NoCheckMark" Opacity="0" Visibility="Visible">
                                            <Canvas.LayoutTransform>
                                                <RotateTransform Angle="90" />
                                            </Canvas.LayoutTransform>

                                            <Canvas Width="300" Height="300" Canvas.Left="0" Canvas.Top="0">
                                                <Canvas Canvas.Top="15">
                                                    <!-- Needle -->
                                                    <Path VerticalAlignment="Center" Fill="{DynamicResource CheckPinFill}">
                                                        <Path.Data>
                                                            <PathGeometry>
                                                                <PathGeometry.Figures>
                                                                    <PathFigureCollection>
                                                                        <PathFigure IsClosed="True" StartPoint="0,0">
                                                                            <PathFigure.Segments>
                                                                                <PathSegmentCollection>
                                                                                    <LineSegment Point="45,50" />
                                                                                    <LineSegment Point="45,85" />
                                                                                    <LineSegment Point="55,95" />
                                                                                    <LineSegment Point="55,50" />
                                                                                    <LineSegment Point="45,50" />
                                                                                </PathSegmentCollection>
                                                                            </PathFigure.Segments>
                                                                        </PathFigure>
                                                                    </PathFigureCollection>
                                                                </PathGeometry.Figures>
                                                            </PathGeometry>
                                                        </Path.Data>
                                                    </Path>

                                                    <Line X1="45" Y1="50" X2="45" Y2="85" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X1="45" Y1="85" X2="55" Y2="95" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X2="55" Y2="95" X1="55" Y1="50" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <!-- Line X1="55" Y1="50" X2="45" Y2="50" Stroke="White" Opacity="0.5" StrokeThickness="3" / -->
                                                    <!-- Needle -->

                                                    <Path VerticalAlignment="Center" Fill="{DynamicResource CheckPinFill}">
                                                        <Path.Data>
                                                            <PathGeometry>
                                                                <PathGeometry.Figures>
                                                                    <PathFigureCollection>
                                                                        <PathFigure IsClosed="True" StartPoint="0,0">
                                                                            <PathFigure.Segments>
                                                                                <PathSegmentCollection>
                                                                                    <LineSegment Point=" 5,50" />
                                                                                    <LineSegment Point="95,50" />
                                                                                    <LineSegment Point="85,40" />
                                                                                    <LineSegment Point="15,40" />
                                                                                    <LineSegment Point=" 5,50" />
                                                                                </PathSegmentCollection>
                                                                            </PathFigure.Segments>
                                                                        </PathFigure>
                                                                    </PathFigureCollection>
                                                                </PathGeometry.Figures>
                                                            </PathGeometry>
                                                        </Path.Data>
                                                    </Path>

                                                    <Line X1="5"  Y1="50" X2="95" Y2="50" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X1="95" Y1="50" X2="85" Y2="40" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X2="85" Y2="40" X1="15" Y1="40" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X1="15" Y1="40" X2="5"  Y2="50" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                </Canvas>

                                                <Path VerticalAlignment="Center" Fill="{DynamicResource CheckPinFill}">
                                                    <Path.Data>
                                                        <PathGeometry>
                                                            <PathGeometry.Figures>
                                                                <PathFigureCollection>
                                                                    <PathFigure IsClosed="True" StartPoint="0,0">
                                                                        <PathFigure.Segments>
                                                                            <PathSegmentCollection>
                                                                                <LineSegment Point="25,55" />
                                                                                <LineSegment Point="75,55" />
                                                                                <LineSegment Point="75,10" />
                                                                                <LineSegment Point="25,10" />
                                                                                <LineSegment Point="25,55" />
                                                                            </PathSegmentCollection>
                                                                        </PathFigure.Segments>
                                                                    </PathFigure>
                                                                </PathFigureCollection>
                                                            </PathGeometry.Figures>
                                                        </PathGeometry>
                                                    </Path.Data>
                                                </Path>

                                                <!-- Line X1="25" Y1="55" X2="75" Y2="55" Stroke="Yellow" Opacity="0.5" StrokeThickness="3" / -->
                                                <Line X1="75" Y1="55" X2="75" Y2="10" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                <Line X2="75" Y2="10" X1="25" Y1="10" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                <Line X1="25" Y1="10" X2="25" Y2="55" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />

                                            </Canvas>

                                        </Canvas>

                                        <Canvas Width="100" Height="100" x:Name="CheckMark">
                                            <!-- Needle Pin in pined mode XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
                                            <!-- Canvas.LayoutTransform>
  		                                      <ScaleTransform CenterX="50" CenterY="50" ScaleX=".15" ScaleY=".15" />
  	                                          </Canvas.LayoutTransform -->
                                            <!-- Border BorderBrush="Black" BorderThickness="1" Width ="100" Height="100" / -->

                                            <Canvas Width="300" Height="300" Canvas.Left="0" Canvas.Top="0">
                                                <Canvas Canvas.Top="15">
                                                    <!-- Needle -->
                                                    <Path VerticalAlignment="Center" Fill="{DynamicResource CheckPinFill}">
                                                        <Path.Data>
                                                            <PathGeometry>
                                                                <PathGeometry.Figures>
                                                                    <PathFigureCollection>
                                                                        <PathFigure IsClosed="True" StartPoint="0,0">
                                                                            <PathFigure.Segments>
                                                                                <PathSegmentCollection>
                                                                                    <LineSegment Point="45,50" />
                                                                                    <LineSegment Point="45,85" />
                                                                                    <LineSegment Point="55,95" />
                                                                                    <LineSegment Point="55,50" />
                                                                                    <LineSegment Point="45,50" />
                                                                                </PathSegmentCollection>
                                                                            </PathFigure.Segments>
                                                                        </PathFigure>
                                                                    </PathFigureCollection>
                                                                </PathGeometry.Figures>
                                                            </PathGeometry>
                                                        </Path.Data>
                                                    </Path>

                                                    <Line X1="45" Y1="50" X2="45" Y2="85" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X1="45" Y1="85" X2="55" Y2="95" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X2="55" Y2="95" X1="55" Y1="50" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <!-- Line X1="55" Y1="50" X2="45" Y2="50" Stroke="White" Opacity="0.5" StrokeThickness="3" / -->
                                                    <!-- Needle -->

                                                    <Path VerticalAlignment="Center" Fill="{DynamicResource CheckPinFill}">
                                                        <Path.Data>
                                                            <PathGeometry>
                                                                <PathGeometry.Figures>
                                                                    <PathFigureCollection>
                                                                        <PathFigure IsClosed="True" StartPoint="0,0">
                                                                            <PathFigure.Segments>
                                                                                <PathSegmentCollection>
                                                                                    <LineSegment Point=" 5,50" />
                                                                                    <LineSegment Point="95,50" />
                                                                                    <LineSegment Point="85,40" />
                                                                                    <LineSegment Point="15,40" />
                                                                                    <LineSegment Point=" 5,50" />
                                                                                </PathSegmentCollection>
                                                                            </PathFigure.Segments>
                                                                        </PathFigure>
                                                                    </PathFigureCollection>
                                                                </PathGeometry.Figures>
                                                            </PathGeometry>
                                                        </Path.Data>
                                                    </Path>

                                                    <Line X1="5"  Y1="50" X2="95" Y2="50" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X1="95" Y1="50" X2="85" Y2="40" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X2="85" Y2="40" X1="15" Y1="40" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                    <Line X1="15" Y1="40" X2="5"  Y2="50" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                </Canvas>

                                                <Path VerticalAlignment="Center" Fill="{DynamicResource CheckPinFill}">
                                                    <Path.Data>
                                                        <PathGeometry>
                                                            <PathGeometry.Figures>
                                                                <PathFigureCollection>
                                                                    <PathFigure IsClosed="True" StartPoint="0,0">
                                                                        <PathFigure.Segments>
                                                                            <PathSegmentCollection>
                                                                                <LineSegment Point="25,55" />
                                                                                <LineSegment Point="75,55" />
                                                                                <LineSegment Point="75,10" />
                                                                                <LineSegment Point="25,10" />
                                                                                <LineSegment Point="25,55" />
                                                                            </PathSegmentCollection>
                                                                        </PathFigure.Segments>
                                                                    </PathFigure>
                                                                </PathFigureCollection>
                                                            </PathGeometry.Figures>
                                                        </PathGeometry>
                                                    </Path.Data>
                                                </Path>

                                                <!-- Line X1="25" Y1="55" X2="75" Y2="55" Stroke="Yellow" Opacity="0.5" StrokeThickness="3" / -->
                                                <Line X1="75" Y1="55" X2="75" Y2="10" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                <Line X2="75" Y2="10" X1="25" Y1="10" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />
                                                <Line X1="25" Y1="10" X2="25" Y2="55" Stroke="{DynamicResource CheckPinBorder}" Opacity="0.5" StrokeThickness="3" />

                                            </Canvas>
                                        </Canvas>
                                    </Grid>
                                </Viewbox>
                            </BulletDecorator.Bullet>
                        </BulletDecorator>
                    </Border>

                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <!-- Condition Property="IsMouseOver" Value="True"/ -->
                                <Condition Property="IsChecked" Value="False"/>
                            </MultiTrigger.Conditions>

                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="NoCheckMark" To="0.45" Duration="0:0:0.1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="NoCheckMark" To="0" Duration="0:0:0.1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>

                        </MultiTrigger>

                        <Trigger Property="IsChecked" Value="True">
                            <!-- Setter TargetName="CheckBorder" Property="Opacity" Value="1"/ -->
                            <Setter TargetName="CheckMark" Property="Opacity" Value="1"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="False">
                            <!-- Setter TargetName="CheckBorder" Property="Opacity" Value="0"/ -->
                            <Setter TargetName="CheckMark" Property="Opacity" Value="0"/>
                        </Trigger>

                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
